export {}
//接口
interface User{
    // private String name
    name:string,
    age:number
    address?:string    //? 可选属性
}

//规范 user的类型
const user1:User =  { name:'jshand',age:18,address:'黑龙江'}
const user2:User =  { name:'jshand',age:18}

function introduce(obj:any){
    console.log("你好 "+obj.name);
    console.log("10年之后你的年龄是 "+ (obj.age + 10));
}


introduce(user1)



interface Person{
    readonly id:string,  //只读属性
    name:string,
    age:number,
    [propName: string]: any   //任意属性
}

let p1:Person = {
    id: "1888838-1211--1212",  //不可以修改
    name: "jshand",
    age: 18,
    address:''
} 

// p1.id = "abcdf"
p1.age = 20

console.log(p1);
